---
title: Retrieve a provider location and its lazily-loaded graph
summary: Loads a single clsProviderLocation and exposes lazy navigation properties to its related data.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-21
library: SAIF.Business.View.Provider
reference_type: embedded
operation_id: OP-02
trigger: Caller request (e.g. LegalManagerBase.CurrentProviderId setter, clsCaseCostManager.GetProviderName, clsCaseCost.OnRetrieve)
---

# Retrieve a provider location and its lazily-loaded graph

Loads a single `clsProviderLocation` by its surrogate key and exposes lazily-loaded navigation properties (addresses, relationships, ineligibility periods, provider type, owning provider, DCBS cost charges, MCO enrollments, services, and service contracts).

| Field | Value |
| --- | --- |
| **Operation ID** | OP-02 |
| **Trigger** | Caller request — e.g. `LegalManagerBase.CurrentProviderId` setter, `clsCaseCostManager.GetProviderName`, `clsCaseCost.OnRetrieve` |
| **Inputs** | `IDataPortalInfo`, provider-location ID |
| **Outputs** | `clsProviderLocation` |
| **Primary components** | `clsProviderLocation.GetProviderLocation` |
| **Entry point** | `SAIF.Business.View.Provider/clsProviderLocation.vb:592` |

## Steps

1. Build `Criteria(dpi, inProviderLocationID)`; call `RetrieveObject`.
2. `BeforeRetrieve` creates update info, sets `SQLStatement = RETRIEVE_SQL`, and binds `:ProviderLocationID` ([SQL-PLOC-01](../sql/SQL-PLOC-01-provider-location-by-id.md) against [PROVIDER_LOCATION](../database-tables.md#provider_location)).
3. `AfterRetrieve` reads the first row; `Fill()` maps ~27 columns (flags via `.ToBoolean`, name parts into `clsName`, phone parts concatenated into `clsPhone`), then `MarkOld()`.
   - On failure: if no row is returned, the object retains default field values.
4. Rules [BR-PLOC-001](../business-rules.md#br-ploc-001-provider-location-id-must-be-positive) (Level I), [BR-PLOC-002](../business-rules.md#br-ploc-002-provider-id-must-be-positive) and [BR-PLOC-003](../business-rules.md#br-ploc-003-provider-type-code-must-be-non-empty) (Level III) are registered at construction.
5. On demand only, each navigation property issues a further query:
   - `Addresses` → [Load and select a provider-location address](load-and-select-provider-address.md)
   - `ChildRelationships` / `ParentRelationships` → [Load provider relationships](load-provider-relationships.md)
   - `IneligibilityPeriods` → [Load provider ineligibility periods](load-provider-ineligibility-periods.md)
   - `ProviderType` → [Load a provider type](load-provider-type.md)
   - `Provider` → [Retrieve a provider by ID or primary tax ID](retrieve-provider-by-id-or-tax-id.md)
   - `DCBSCostCharges` → [Load DCBS cost-charge factors](load-dcbs-cost-charge-factors.md)
   - `MCOList` → [Load MCO enrollments](load-mco-enrollments.md)
   - `Services` / `ServiceContracts` → [Load provider services and service contracts](load-provider-services-and-contracts.md)
   - If `IneligibilityPeriods` is accessed: no backing field is used — every access re-queries `PROVIDER_INELIG_PERIOD`.*

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Caller request]) --> S1["Build Criteria dpi,<br>ProviderLocationID"]
	S1 --> S2["RetrieveObject via<br>IDataPortalInfo"]
	S2 --> S3["BeforeRetrieve binds<br>ProviderLocationID"]
	S3 --> S4{Row returned?}
	S4 -->|Yes| S5["AfterRetrieve: Fill ~27<br>columns, MarkOld"]
	S4 -->|No| S6["Default-valued<br>clsProviderLocation"]
	S5 --> S7["Rules BR-PLOC-001..003<br>registered"]
	S6 --> S7
	S7 --> S8["Navigation property<br>accessed?"]
	S8 -->|Yes| S9[Lazy query per property<br>separate round trip each time]
	S8 -->|No| EndOk([clsProviderLocation returned])
	S9 --> EndOk
```

## Failure and edge-case behavior

- No matching row: object retains default field values; [BR-PLOC-001](../business-rules.md#br-ploc-001-provider-location-id-must-be-positive) / [BR-PLOC-002](../business-rules.md#br-ploc-002-provider-id-must-be-positive) detect the invalid state.
- Every navigation property access is a separate database round trip (a per-property N+1 pattern).*
- `IneligibilityPeriods` re-queries on every access rather than caching, unlike other navigation properties.*

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- `SAIF.Business.View.Provider/clsProviderLocation.vb`
